package com.hktf.uilib.adapter;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hktf.corelib.utils.CommUtils;
import com.hktf.uilib.bean.ColorItem;
import com.hktf.uilib.bean.FontItem;
import com.hktf.uilib.R;

import java.util.List;

/**
 * @包名称： com.cdz.bluetooth.adapter
 * @类名： BluetoothViewAdapter
 * @创建人： 陈大专
 * @时间： 2021/08/17 14:06
 * @描述：
 */
public class ColorItemAdapter extends BaseQuickAdapter<ColorItem, BaseViewHolder> {
    public ColorItemAdapter(@Nullable List<ColorItem> data) {
        super(R.layout.color_item,data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ColorItem item) {
        helper.setBackgroundRes(R.id.rl1,item.isCheck()?R.drawable.blue_circle_bg:R.drawable.transparent);
        helper.setGone(R.id.tv,!item.isShowIcon());
        helper.setGone(R.id.iv,item.isShowIcon());
        if (item.isShowIcon()) {

        }else {
            TextView tv = helper.getView(R.id.tv);
            GradientDrawable background = (GradientDrawable) tv.getBackground();
            background.setColor(item.getColor());
        }
    }
}
